package com.rhtchr.util;

import java.io.ByteArrayInputStream;

import com.opensymphony.xwork2.ActionContext;

public class ValidateImage extends DefaultAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ByteArrayInputStream inputStream;

	public String execute() throws Exception {
		RandomNumUtil rdnu = RandomNumUtil.Instance();
		ActionContext.getContext().getSession().put("validate_image_code", rdnu.getValidateCode());
		setInputStream(rdnu.getImage());// 取得带有随机字符串的图片
		return SUCCESS;
	}

	public void setInputStream(ByteArrayInputStream inputStream) {
		this.inputStream = inputStream;
	}

	public ByteArrayInputStream getInputStream() {
		return inputStream;
	}
}
